import java.util.ArrayList;
import java.util.List;

class ComponentComposite extends Component {
    private List<Component> children = new ArrayList<>();

    public ComponentComposite(String name) {
        super(name);
    }

    @Override
    public void addChild(Component component) {
        children.add(component);
    }

    @Override
    public void removeChild(Component component) {
        children.remove(component);
    }


    @Override
    public void operation(String document) {
        System.out.println(name + " 收到公文：" + document);
        System.out.println(name + " 下发公文：" + document);
        for (Component component : children) {
            component.operation(document);
        }
    }
}
